package main.ServiceImpli;

/**
 * 作者: ALIM-MASTIK
 * 创建实现: 2023/7/15 9:29
 * 项目名称：chat
 * 软件: IntelliJ IDEA
 */
import main.Daoimpl.FriendshipDAOImpl;
import main.Service.FriendshipService;
import main.dao.FriendshipDAO;
import main.pojo.Friendship;

import java.util.List;

public class FriendshipServiceImpl implements FriendshipService {
    private FriendshipDAO friendshipDAO=new FriendshipDAOImpl();

    public FriendshipServiceImpl(FriendshipDAO friendshipDAO) {
        this.friendshipDAO = friendshipDAO;
    }
    public  FriendshipServiceImpl(){}
    @Override
    public Friendship getFriendshipByID(int friendshipID)   {
        return friendshipDAO.getFriendshipByID(friendshipID);
    }

    @Override
    public List<Friendship> getFriendshipsByUser(int userID)   {
        return friendshipDAO.getFriendshipsByUser(userID);
    }
    @Override
    public Boolean createFriendship(Friendship friendship)  {
            return friendshipDAO.createFriendship(friendship);
    }
    @Override
    public Boolean deleteFriendship(int friendshipID)  {
        if (friendshipDAO.deleteFriendship(friendshipID)!=null){
            return true;
        }else {
            return false;
        }
    }
}
